<?php
/**
 * Category Reorder Page
 * 
 * Allows the user to change the order that categories are displayed on the site's front-end.
 */
?>
<div class="header">
	<h2>Reorder Categories</h2>
	<div class="add">
		<a href="<?= $this->routeUrl('admin_category_list') ?>">Back to Category List</a>
	</div>
	<div style="clear:both"></div>
</div>
<div id="categoryreorder">
	<table class="admin">
		<thead>
			<tr>
				<th><a href="<?= $this->routeUrl('admin_category_list', null, array('order' => 'category_id', 'dir' => $this->dir)) ?>">ID</a></th>
				<th><a href="<?= $this->routeUrl('admin_category_list', null, array('order' => 'name', 'dir' => $this->dir)) ?>">Name</a></th>
				<th><a href="<?= $this->routeUrl('admin_category_list', null, array('order' => 'is_active', 'dir' => $this->dir)) ?>">Active?</a></th>
				<th> &nbsp; </th>
			</tr>
		</thead>
		<tbody>
			<?php foreach ($this->categories as $cat): ?>
				<tr class="category <?= $this->cycle(array('odd', 'even'))->next() ?>">
					<th class="category_id"><?= $this->e($cat['category_id']) ?></th>
					<td class="name"><a href="<?= $this->routeUrl('admin_category_edit', array('category_id' => $cat['category_id'])) ?>"><?= $this->e($cat['name']) ?></a></td>
					<td class="is_active"><?= ($cat['is_active']) ? "Yes" : "No" ?></td>
					<td class="buttons">
						<form method="post" action="<?= $this->routeUrl('admin_category_setorder', array('category_id' => $cat['category_id'])) ?>">
							<?= $this->formText('order', $cat['order'], array('size' => '2')) ?>
							<input type="submit" value="Set">
						</form>
					</td>
				</tr>
			<?php endforeach ?>
		</tbody>
	</table>
	
	<?= $this->paginationControl($this->categories) ?>

</div> <!-- /#productadmin -->